<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <!-- status只允许传递success和fail -->
        <heima-button status="sdfsdf">
            按钮名字
        </heima-button>
    </div>
</body>
<script>
    const HeimaButton = {
        props: {
            status: {
                type: String,
                required: true,
                validator: function(value) {
                    if (value === 'success' || value === 'fail') {
                        return true
                    } else {
                        // 提醒用户传递参数错误
                        console.error('[HeimaUI warn]：status只允许success|fail，但是传入的是' + value)
                        return false
                    }
                }
            }
        },
        template: '<button><slot></slot></button>'
    }
    const app = new Vue({
        el: '#app',
        components: {
            HeimaButton
        }
    })
</script>
</html>